package com.daydayup.learn;

import lombok.Getter;

public class RefOrVal {

    public static void change(Person p){
        p.setName("xxx");
    }

    public static void changeInt(Integer n) {
        n = 200;
    }

    public static void main(String[] args) {

        Integer num = 100;
        changeInt(num);
        System.out.println(num);

        Person person = new Person("abc");
        change(person);

        System.out.println(person.getName());

    }

    @Getter
    final static class Person {
        private String name;

        public Person(String name){
            this.name = name;
        }

        public void setName(String name) {
            this.name = name;
        }

    }
}
